/**
 */
package at.fhooe.agaeScriptDsl.impl;

import at.fhooe.agaeScriptDsl.AgaeScriptDslPackage;
import at.fhooe.agaeScriptDsl.Button;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Button</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link at.fhooe.agaeScriptDsl.impl.ButtonImpl#getButtonText <em>Button Text</em>}</li>
 *   <li>{@link at.fhooe.agaeScriptDsl.impl.ButtonImpl#getBtnHandlerName <em>Btn Handler Name</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ButtonImpl extends GuiItemImpl implements Button
{
  /**
   * The default value of the '{@link #getButtonText() <em>Button Text</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getButtonText()
   * @generated
   * @ordered
   */
  protected static final String BUTTON_TEXT_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getButtonText() <em>Button Text</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getButtonText()
   * @generated
   * @ordered
   */
  protected String buttonText = BUTTON_TEXT_EDEFAULT;

  /**
   * The default value of the '{@link #getBtnHandlerName() <em>Btn Handler Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBtnHandlerName()
   * @generated
   * @ordered
   */
  protected static final String BTN_HANDLER_NAME_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getBtnHandlerName() <em>Btn Handler Name</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBtnHandlerName()
   * @generated
   * @ordered
   */
  protected String btnHandlerName = BTN_HANDLER_NAME_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ButtonImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return AgaeScriptDslPackage.Literals.BUTTON;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getButtonText()
  {
    return buttonText;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setButtonText(String newButtonText)
  {
    String oldButtonText = buttonText;
    buttonText = newButtonText;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AgaeScriptDslPackage.BUTTON__BUTTON_TEXT, oldButtonText, buttonText));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getBtnHandlerName()
  {
    return btnHandlerName;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setBtnHandlerName(String newBtnHandlerName)
  {
    String oldBtnHandlerName = btnHandlerName;
    btnHandlerName = newBtnHandlerName;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, AgaeScriptDslPackage.BUTTON__BTN_HANDLER_NAME, oldBtnHandlerName, btnHandlerName));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case AgaeScriptDslPackage.BUTTON__BUTTON_TEXT:
        return getButtonText();
      case AgaeScriptDslPackage.BUTTON__BTN_HANDLER_NAME:
        return getBtnHandlerName();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case AgaeScriptDslPackage.BUTTON__BUTTON_TEXT:
        setButtonText((String)newValue);
        return;
      case AgaeScriptDslPackage.BUTTON__BTN_HANDLER_NAME:
        setBtnHandlerName((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case AgaeScriptDslPackage.BUTTON__BUTTON_TEXT:
        setButtonText(BUTTON_TEXT_EDEFAULT);
        return;
      case AgaeScriptDslPackage.BUTTON__BTN_HANDLER_NAME:
        setBtnHandlerName(BTN_HANDLER_NAME_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case AgaeScriptDslPackage.BUTTON__BUTTON_TEXT:
        return BUTTON_TEXT_EDEFAULT == null ? buttonText != null : !BUTTON_TEXT_EDEFAULT.equals(buttonText);
      case AgaeScriptDslPackage.BUTTON__BTN_HANDLER_NAME:
        return BTN_HANDLER_NAME_EDEFAULT == null ? btnHandlerName != null : !BTN_HANDLER_NAME_EDEFAULT.equals(btnHandlerName);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (buttonText: ");
    result.append(buttonText);
    result.append(", btnHandlerName: ");
    result.append(btnHandlerName);
    result.append(')');
    return result.toString();
  }

} //ButtonImpl
